package com.googlecode.smartbinding.framework.core;

import com.googlecode.smartbinding.framework.converter.IConverter;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author Iulian Dumitru
 */
public class SwingBindingStrategy implements BindingStrategy {

    public SwingBindingStrategy(JComponent component, Object pojo, String propertyName, Class<?> propertyType, IConverter converter) {

        if (component instanceof JTextField) {

            final JTextField textField = (JTextField) component;
            textField.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {

                    String text = textField.getText();

                    //set pojo property

                }
            });


        }


    }

    @Override
    public void sourceUpdated() {


    }

    @Override
    public void targetUpdated() {


    }
}
